import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutterroom/pages/my/until/common_picker.dart';
import 'package:flutterroom/pages/my/widget/my_add_room_title_list.dart';

class RoomSelectFormItem extends StatelessWidget {
  final String label;
  final int value;
  final List<String> options;
  final Function(int) onChange;

  const RoomSelectFormItem(
      {Key key, this.label, this.value, this.options, this.onChange})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return RoomPriceItemWidget(
      label: label,
      contentBuilder: (context) {
        return GestureDetector(
          behavior: HitTestBehavior.translucent,
          onTap: () {
            var result =CommonPicker.showPicker(
              context: context,options: options,value: value);

              result.then((selectedValue){
                if(value!=selectedValue&&selectedValue!=null&&onChange!=null){
                  onChange(selectedValue);
                }
              });

          },
          child: Container(
            width: ScreenUtil().setWidth(750) - 130,
            height: 50,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Text(
                  options[value],
                  style: TextStyle(fontSize: 16),
                ),
                Icon(Icons.keyboard_arrow_right),
              ],
            ),
          ),
        );
      },
    );
  }
}
